#include <iostream>

extern "C" {
#include <postgres.h>

#include <catalog/pg_collation_d.h>
#include <catalog/pg_operator_d.h>
#include <catalog/pg_type_d.h>
#include <nodes/makefuncs.h>
#include <nodes/primnodes.h>
#include <postgres_ext.h>
#include <utils/lsyscache.h>
}

#include "common/pg_guard.h"
#include "utils/pg_test.h"

namespace optimizer {

TEST(ExpressionTest, TestException) {
  try {
    pg_guard([] { elog(ERROR, "test exception..."); });
  } catch (const std::exception& e) {
    // PG_RE_THROW();
    std::cout << "exception: " << e.what() << "\n";
    FlushErrorState();
  }
}

TEST(Test, PgTestSimple2) {
  EXPECT_EQ(1, 1);

  EXPECT_NE(2, 1);
  EXPECT_LE(1, 1);
  EXPECT_LT(1, 2);
  EXPECT_GE(1, 1);
  EXPECT_GT(2, 1);

  EXPECT_EQ(std::string("val1"), std::string("val1"));
}

}  // namespace optimizer
